package rejahealth.util;

import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.text.SimpleDateFormat;
import java.util.Date;
import javax.swing.JLabel;
import javax.swing.Timer;
/**
 * @author Tiago Tiveron
 */
public class DigitalClock extends JLabel implements ActionListener {
    
    protected SimpleDateFormat formatDate = new SimpleDateFormat("E, dd/MM/YYYY HH:mm:ss");
    
    public DigitalClock() {
        this.setText(formatDate.format((new Date())));
        Timer t = new Timer(1000, this);
        t.start();        
    }
    
    @Override
    public void actionPerformed(ActionEvent ae) {
        this.setText(formatDate.format((new Date())));
    }
    
}